//
//  YHModuleTwoViewController_4.m
//  YHRouter_Example
//
//  Created by 98du on 2021/12/2.
//  Copyright © 2021 林宁宁. All rights reserved.
//

#import "YHModuleTwoViewController_4.h"
@import YHRouter;

@interface YHModuleTwoViewController_4 ()

@property (copy, nonatomic) NSString * content;
@property (retain, nonatomic) UILabel * labelParam;

@end

@implementation YHModuleTwoViewController_4

-(BOOL)yh_routerIsSingleton{
    return YES;
}

-(void)yh_routerPassReloadParams:(YHRouterParam *)parameters{
    self.content = parameters.arg1;
    self.labelParam.text = [NSString stringWithFormat:@"content : %@",self.content];
}

-(void)yh_routerPassParams:(YHRouterParam *)parameters{
    self.content = parameters.arg1;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"该控制器唯一";

    UILabel * labelParam = [UILabel new];
    self.labelParam = labelParam;
    labelParam.textAlignment = NSTextAlignmentCenter;
    labelParam.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.2];
    labelParam.frame = CGRectMake(0, 0, CGRectGetWidth(self.view.frame), 300);
    labelParam.font = [UIFont boldSystemFontOfSize:20];
    labelParam.numberOfLines = 0;
    [self.view addSubview:labelParam];
    labelParam.text = [NSString stringWithFormat:@"content : %@",self.content];
    
    UIButton * btnPush = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [btnPush setTitle:@"Push" forState:(UIControlStateNormal)];
    [btnPush addTarget:self action:@selector(pushEvent) forControlEvents:(UIControlEventTouchUpInside)];
    btnPush.frame = CGRectMake(0, 320, CGRectGetWidth(self.view.frame), 44);
    [self.view addSubview:btnPush];
}

- (void)pushEvent{
    [YHRouter yh_pushKey:@"YHModuleTwoViewController_3" params:[YHRouterParam params:@(YES), nil]];
}

-(void)dealloc{
    NSLog(@"YHModuleTwoViewController_4 该唯一控制器释放了");
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
